Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few function ideas #5

Open
NotTooManyItems opened this issue Apr 19, 2015 · 6 comments
Open

A few function ideas #5

NotTooManyItems opened this issue Apr 19, 2015 · 6 comments

Comments

@NotTooManyItems
Copy link

I'm not sure how many of these can already be done in trans4 with lua, but I thought I'd put them here anyway.

clear([cnv])
getPixel(x, y, &r, &g, &b, [cnv])
getRes(&w, &h)
gettextheight(text)
gettextwidth(text)
pixelText(x, y, str, [cnv])
random(min, max)
split(str, delimiter, arr)

@mariobadr
Copy link

At the moment, all default lua libraries are available to you, so things like splitting strings and random numbers are available (http://stackoverflow.com/questions/1426954/split-string-in-lua for splitting strings, http://lua-users.org/wiki/MathLibraryTutorial for random numbers). This may not be the case in the future though.

We still don't have any text rendering functionality, but when we do I'll see if I can get width/height information for a string at whatever font.

@goblinJoel
Copy link

One catch I've run into is properly computing width and height in text that has things like linebreaks. That's not really hard, just a bit of a gotcha if you forget.

@Asimir
Copy link

Asimir commented Apr 20, 2015

Even if a function you want can already be done in Lua, you should still suggest it. At some point we will be sandboxing Lua, which means the user won't be able to use any Lua functions or libraries unless we explicitly allow it.

@codelish
Copy link

Sorry if this is a bit off-topic, but has there been any discussion on function naming rules/schemes? Hopefully something more consistent than the current implement is formalised, as RPG Code is a bit PHPesque in the random function naming and argument orders.

@swordmaster2k
Copy link
Member

I recommend that the new language implementation follow Lua standards. RPGCode's conventions are a mash of VB, C/C++, JS etc... They're pretty inconsistent.

@mariobadr
Copy link

Yes, Asimir is correct (RE: sandboxing)

As for naming conventions, right now there are none lol. However it is very easy to change the names and ordering of arguments, so I don't think this is too big of an issue. Once we know what the bulk of the commands are going to be, we can decide how to organize/name them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants