Live data from Hacker News

Pocketlang

github.com

1–10 of 63 posts

Re: Pocketlang

#2
This is pretty neat. I’ve been tinkering with Lua on ARM, so I’m curious to know how it compares to LuaJIT.

Re: Pocketlang

#5
Cute but pkInterpretSource() doesn't have any throttling, like the amount of instructions/nodes to execute before suspending, this would be very useful in games. You could limit NPC's ai to 50 instructions or so so that it doesn't cause rendering lag and the ai script would be run in multiple frames until it finishes.

Re: Pocketlang

#7

What about generic algorithms like filter/map. Is it python style like map(fn, filter(...))?

Looks like it supports higher order functions, so you could just implement those yourself.

Re: Pocketlang

#9
post #5

Cute but pkInterpretSource() doesn't have any throttling, like the amount of instructions/nodes to execute before suspending, this would be very useful in games. You could limit NPC's ai to 50 instructions or so so that it doesn't cause rendering lag and the ai script would be run in multiple frames until it finishes.

I guess the fiber/coroutine support would be a better solution to this problem? If this works like I think it should work, the code can decide itself when it is a good time to yield control back to the environment instead of freezing execution in a random location until the next frame.

For instance when evaluating NPC AIs it may be important that an NPC isn't left dangling in a random state at the end of a frame, but either has finished evaluating, or hasn't started yet.

https://thakeenathees.github.io/pocketlang/language-api-fibe...

Re: Pocketlang

#10
This looks nice! Is there a sample how to implement your own module in C and bind that to the scripting language?

[Edit]: To answer myself the API seems really clean and neat, it looks like the patterns used to implement the standard modules can be used as is - e.g. to implement a third party native module, a good pattern to start from is to observe how _fileOpen is implemented in cli/modules.c and added to module using pkModuleAddFunction

Post reply on HN