lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 05/03/17 01:53 PM, Petri Häkkinen wrote:
On Mar 5, 2017, at 4:26 PM, "Soni L." <> wrote:
Here's a challenge for you:

Write an extensible game modding API, using only static non-replaceable functions, and without ever deferring to an object function inside them.
Sorry, I don't understand. What's an "object function" and "static non-replaceable function"? In Lua there is just one function type.

Also, I don't see how not using "self" would stop me from writing a modding API.


Write a modding API where you use

get_inventory_item(something, slot) -- aka a "static non-replaceable function"

And "get_inventory_item" cannot be replaced and you don't call a function from "something" through it. So e.g. no

function get_inventory_item(something, slot)
return something.get_inventory_item(something, slot) -- aka an "object function"

And no having a lookup table to map objects to functions.

Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.