falseprophet Posted July 4, 2011 Posted July 4, 2011 I want to separate my script sources into a neatly packaged.. package so everything is easily readable. When I use require "foo/bar.lua" I receive: ERROR: server_main.lua:1: Unsafe function was called. I'm just curious as to why I cannot use require for a server side script.
eAi Posted July 4, 2011 Posted July 4, 2011 You can do the same with meta.xml. Require would let you load a file from an arbitrary path.
falseprophet Posted July 4, 2011 Author Posted July 4, 2011 You can do the same with meta.xml. Require would let you load a file from an arbitrary path. Wouldn't variable data be lost in the process, though? I mainly want to throw all of my variables / tables / arrays / what not in a secondary file and label it as an include.
SDK Posted July 4, 2011 Posted July 4, 2011 You don't need to, global variables can be shared between script files in the same resource(but only on the same side: server-server and client-client)
eAi Posted July 5, 2011 Posted July 5, 2011 Have a look how some of the standard resources are set up - many of them are split over a number of different files.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now