|
On 05/03/17 01:53 PM, Petri Häkkinen wrote:
On Mar 5, 2017, at 4:26 PM, "Soni L." <fakedme@gmail.com> 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. Petri
Write a modding API where you useget_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"
end 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.