About Monkey 2 › Forums › Monkey 2 Development › Lua
Tagged: lua
This topic contains 20 replies, has 5 voices, and was last updated by 
 Samah 2 years, 8 months ago.
- 
		AuthorPosts
 - 
		
			
				
July 12, 2016 at 2:50 am #2058
Okay… but when using the zip from GitHub it doesnt get included… also what happens if they remove the repos? (not saying they will… but you never know ;))
July 12, 2016 at 3:38 am #2059Always the pessimist!
I’ll have a look at it tonight.Edit: Done. Now using the official 5.3.3 release.
July 12, 2016 at 10:03 pm #2079Haha!
I’ll have to have a good play over the weekend
(BTW luadist folder is still there)
July 12, 2016 at 11:45 pm #2081Fixed. Stupid git (not you).
git rm --cached native/luadistI’m working on a simple Mojo demo project at the moment, hopefully with a “reload script” shortcut. At the moment you’re mostly limited to calling MX2 functions that you declare yourself, so it’s still WIP for usefulness. Coming along, though!
Reloading scripts will need to use DoFile rather than DoString(LoadString), as I believe the assets get baked into the distribution.
Note when using DoString/DoFile/PCall, make sure to wrap it with an if statement and grab the string value at the top of the stack. If there was an error somewhere in your script, that error message will be on the stack. You can also give custom error messages in your MX2 registered functions using state.Error/ lua_error. This will push the error message and raise an exception that’s caught by the Lua VM. Note that this call does a long jump and never returns.
July 19, 2016 at 3:49 am #2271Worked a bit more on the class binding. At the moment you still need to know how to do some low level stuff, but I hope to make this cleaner in the future.
I added a very simple Mojo demo, too. It has a placeholder for “script reloading”, but you’ll need to change it to DoFile and make sure the Lua file is in the right place. Whenever I test it from my build script, it tries to look in the root monkey2 directory rather than the current directory.
I’d love to see some of your usage examples so that I know how to make it betterer! Note: Coroutines are much nicer for handling entity logic, rather than constantly calling DoString as in my example.
July 27, 2016 at 5:48 am #2472Version 0.1.0 tag added and uploaded for review.
http://monkey2.monkey-x.com/forums/topic/experimental-module-manager-now-online/page/2/#post-2471 - 
		AuthorPosts
 
You must be logged in to reply to this topic.