Attempt to call global 'require' (a nil value)???

Discussion about Mods for Prison Architect

Moderator: NBJeff

ronnie4444
level1
level1
Posts: 36
Joined: Thu Jan 01, 2015 4:49 pm

Attempt to call global 'require' (a nil value)???

Postby ronnie4444 » Fri Jan 23, 2015 11:01 pm

Okay. So, I'm trying to use the require function, which is a STANDARD LUA FUNCTION. However, prison architect throws an error: attempt to call global 'require' (a nil value)

Why does this happen?

It's not really a question about prison architect in particular, but I do know that the culprit has something to do with Prison Architect.


Code: Select all

local websocket = require("websocket")


That's all.

Please, tell me why this is happening, as "require" is absolutely required (pun not intended) for my mod to work.

//Ron
User avatar
Chad
level3
level3
Posts: 255
Joined: Wed Sep 26, 2012 8:00 pm

Re: Attempt to call global 'require' (a nil value)???

Postby Chad » Sat Jan 24, 2015 8:00 am

Some standard lua are not enabled into the mod system.
ronnie4444
level1
level1
Posts: 36
Joined: Thu Jan 01, 2015 4:49 pm

Re: Attempt to call global 'require' (a nil value)???

Postby ronnie4444 » Sat Jan 24, 2015 6:12 pm

So, it turns out that "loadfile()", "dofile()", and the likes are also not there... My only question is why???

It's confusing why anyone would ban "dofile()" and such from their game. This means that my mod just crumbles apart. :/

Anyone know any way to load (and execute code from) a file? loadfile() and dofile() both don't work. I'm starting to just give up :/
User avatar
Pruvan
level2
level2
Posts: 94
Joined: Mon May 27, 2013 4:11 am

Re: Attempt to call global 'require' (a nil value)???

Postby Pruvan » Sat Jan 24, 2015 9:48 pm

ronnie4444 wrote:It's confusing why anyone would ban "dofile()" and such from their game.


My guess is to prevent mods from uploading malicious software to users.
ronnie4444
level1
level1
Posts: 36
Joined: Thu Jan 01, 2015 4:49 pm

Re: Attempt to call global 'require' (a nil value)???

Postby ronnie4444 » Sat Jan 24, 2015 11:33 pm

I guess that makes sense.

Still, it sucks for the rest of us making legitimate mods that need these kind of things :/
ronnie4444
level1
level1
Posts: 36
Joined: Thu Jan 01, 2015 4:49 pm

Re: Attempt to call global 'require' (a nil value)???

Postby ronnie4444 » Sun Jan 25, 2015 1:44 am

And even then, doesn't steam scan mods before they allow said mods to actually show up on the workshop?

And plus, the require, dofile(), etc etc functions require the user to actually have said lua file on their computer. And would you really download an 'essential part' of a mod from an external website if the author didn't include said file in the mod itself on steam, where it's been proven to be safe? Anyways, it's out of my control. Really not happy about that though :/
seronis
level1
level1
Posts: 42
Joined: Fri Dec 05, 2014 1:32 am

Re: Attempt to call global 'require' (a nil value)???

Postby seronis » Sun Jan 25, 2015 9:47 am

No steam only provides the download URLs for the clients to grab the mods from. They have no part in approval of mods and in all the games I mod workshop entries are updated almost instantly from when i submit.
User avatar
Chad
level3
level3
Posts: 255
Joined: Wed Sep 26, 2012 8:00 pm

Re: Attempt to call global 'require' (a nil value)???

Postby Chad » Sun Jan 25, 2015 12:23 pm

ronnie4444 wrote:And even then, doesn't steam scan mods before they allow said mods to actually show up on the workshop?

And plus, the require, dofile(), etc etc functions require the user to actually have said lua file on their computer. And would you really download an 'essential part' of a mod from an external website if the author didn't include said file in the mod itself on steam, where it's been proven to be safe? Anyways, it's out of my control. Really not happy about that though :/


The implementation of a require() function would make modding easier, as repeated code could be put into a library file. And I hope IV enables such a function in the future.

But for sockets and stuff , that could be a security reason and might never be possible!

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest