<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn" -->

---
title: You only need 2 programming languages | daily.dev
description: A rambling opinion piece arguing that developers only need a couple of programming languages, centered on the pairing of Lua and C. After a tangent about Lua's...
canonical: https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: You only need 2 programming languages | daily.dev
og:description: A rambling opinion piece arguing that developers only need a couple of programming languages, centered on the pairing of Lua and C. After a tangent about Lua's...
og:url: https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn
og:image: https://api.daily.dev/og/posts/F6oJR3wkN.png
og:image:alt: You only need 2 programming languages
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# You only need 2 programming languages

**[YouTube](https://daily.dev/sources/youtube)** · 18 min read · 0 upvotes · 0 comments

## Summary

A rambling opinion piece arguing that developers only need a couple of programming languages, centered on the pairing of Lua and C. After a tangent about Lua's use in projects like Hyprland and its origins as a C-embeddable scripting language, the bulk of the content shifts into a hands-on walkthrough of the Lua C API: creating and closing a Lua state, opening standard libraries, running Lua code from C with lua_dostring, loading and executing Lua scripts with luaL_loadfile and lua_pcall, error handling, pushing and setting global variables, and reading tables and calling Lua functions from C.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=9PKSKMsFi2E>

## Questions this post answers

### How do I run a Lua script from within a C program using the Lua C API?

Use luaL_loadfile to load the Lua script onto the stack, then call lua_pcall to execute it in protected mode. First create a Lua state with luaL_newstate, open the standard libraries with luaL_openlibs, then after loading and calling the file, close the state with lua_close to avoid memory leaks. Both loadfile and pcall return non-zero values on failure, so wrapping them in an if-or check lets you print error messages with lua_tostring.

_daily.dev surfaces C and Lua integration guides for developers embedding scripting into native apps._

### How do I read a Lua table's fields from C code using the Lua C API?

Use lua_getglobal to push the table onto the stack, then lua_getfield with index -1 and the field name to fetch a specific value, checking types with functions like lua_isstring or lua_isfunction. Each retrieved value must be popped off the stack afterward with lua_pop, and popping the table itself requires an additional pop once done with its fields.

_Developers wiring Lua scripting into C projects can find these interop patterns through daily.dev._

## Similar posts on daily.dev

- [Creator of Lua: Scripting, Programming Languages, Predictions](https://daily.dev/posts/creator-of-lua-scripting-programming-languages-predictions-irrmt1pkr) · The Developing Dev · 8 upvotes · 0 comments
- [minimalism as a harness](https://daily.dev/posts/minimalism-as-a-harness-alevfxc8x) · Vincent D. Warmerdam · 4 upvotes · 1 comments
- [Lua can be a really cool HTML templating engine](https://daily.dev/posts/lua-can-be-a-really-cool-html-templating-engine-pwy47nz8p) · Lobsters · 0 upvotes · 0 comments
- [Programming Languages Are Authoring Tools for Platforms](https://daily.dev/posts/programming-languages-are-authoring-tools-for-platforms-kpxjlqhjz) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#c](https://daily.dev/tags/c), [#lua](https://daily.dev/tags/lua)

[View this post on daily.dev](https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"You only need 2 programming languages","url":"https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn"},"datePublished":"2026-09-20T10:42:29.089Z","dateModified":"2026-09-20T10:42:48.632Z","description":"A rambling opinion piece arguing that developers only need a couple of programming languages, centered on the pairing of Lua and C. After a tangent about Lua's...","image":"https://i.ytimg.com/vi/9PKSKMsFi2E/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/9PKSKMsFi2E/sddefault.jpg","isAccessibleForFree":true,"articleSection":"YouTube","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"YouTube","logo":"https://media.daily.dev/image/upload/s--W5zMumpP--/f_auto/v1725350181/logos/youtube","url":"https://daily.dev/sources/youtube"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"c,lua","timeRequired":"PT18M","video":{"@type":"VideoObject","name":"You only need 2 programming languages","description":"A rambling opinion piece arguing that developers only need a couple of programming languages, centered on the pairing of Lua and C. After a tangent about Lua's...","thumbnailUrl":"https://i.ytimg.com/vi/9PKSKMsFi2E/sddefault.jpg","uploadDate":"2026-09-20T10:42:29.089Z","duration":"PT18M","url":"https://api.daily.dev/r/F6oJR3wkN","embedUrl":"https://www.youtube.com/embed/9PKSKMsFi2E"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"YouTube","item":"https://daily.dev/sources/youtube"},{"@type":"ListItem","position":3,"name":"You only need 2 programming languages"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/you-only-need-2-programming-languages-f6ojr3wkn#faq","mainEntity":[{"@type":"Question","name":"How do I run a Lua script from within a C program using the Lua C API?","acceptedAnswer":{"@type":"Answer","text":"Use luaL_loadfile to load the Lua script onto the stack, then call lua_pcall to execute it in protected mode. First create a Lua state with luaL_newstate, open the standard libraries with luaL_openlibs, then after loading and calling the file, close the state with lua_close to avoid memory leaks. Both loadfile and pcall return non-zero values on failure, so wrapping them in an if-or check lets you print error messages with lua_tostring. daily.dev surfaces C and Lua integration guides for developers embedding scripting into native apps."}},{"@type":"Question","name":"How do I read a Lua table's fields from C code using the Lua C API?","acceptedAnswer":{"@type":"Answer","text":"Use lua_getglobal to push the table onto the stack, then lua_getfield with index -1 and the field name to fetch a specific value, checking types with functions like lua_isstring or lua_isfunction. Each retrieved value must be popped off the stack afterward with lua_pop, and popping the table itself requires an additional pop once done with its fields. Developers wiring Lua scripting into C projects can find these interop patterns through daily.dev."}}]}
```

