Quickly test Lua code?

When learning a new programming language (such as Lua) one thing I like to do is write quick test programs to try it out. I’d like to get into programming Lua for Garry’s Mod, but one major barrier keeping me from achieving that goal is the long loading time. It takes about 3 minutes on my computer to load Gmod and start a single-player game. I like just playing around with the functions, not needing to wait a long time. Is there some way I can tell Gmod to load a certain addon (not reload everything; that would take too much time) without needing to restart? I would like it if I would not need to wait more than 10 seconds between saving the script file and being able to spawn the entity. Maybe I’m asking too much, but if anyone could help I would greatly appreciate it! :slight_smile:

-snip-

Look at Quebec’s post.

lua_openscript opens a lua file serverside.
lua_openscript_cl does the same clientside. :ninja:
lua_run Runs lua code serverside.
lua_run_cl Does the same clientside.
lua_reloadents reloads all entities (this include weapons)
gamemode_reload Reloads the gamemode’s files.
gamemode_reload_cl I’ll let you guess.

And finally I suggest you use the search function to find Luapad and Lua Reloadent, both of which are available on these forums. They really help testing quick scripts or debugging entities a lot. :smile:

edit : It’s also worth nothing that shift + Up in the console allows you to select previous entries, useful when you have several entities or scripts to reload.

Thanks! I’ll be sure to try that tomorrow! =D That Luapad especially looks good. :slight_smile:

lua_reloadent is a script I made, which reloads a scripted entity, weapon or tool:

EDIT: just noticed you already mentioned it, quebec :smiley:
and it’s lua_openscript_cl, not lua_openscript_cp

:pervert: … :saddowns:

However, dont most of the lua files need to be tested only using GM since alot of stuff is run by the engine and GM itself, and thus a third-party program will make these fail/not work?

That is correct.